package me.pplay.playtalk.adapter;

import java.util.List;

import me.pplay.playtalk.R;
import me.pplay.playtalk.bean.NotificationEntity;
import me.pplay.playtalk.holder.NotificationHolder;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class NotificationAdapter extends BaseAdapter {
	private Context context;
	private List<NotificationEntity> list;

	public NotificationAdapter(Context context, List<NotificationEntity> list) {
		this.context 	= context;
		this.list  	= list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		NotificationHolder holder = null;
		if (convertView == null) {
			holder      = new NotificationHolder();
			convertView = View.inflate(context, R.layout.notification_item, null);
//			iv = (ImageView) convertView.findViewById(R.id.imageview);
			holder.des	= (TextView)convertView.findViewById(R.id.des);
			convertView.setTag(holder);
		} else {
			holder = (NotificationHolder) convertView.getTag();
		}
		NotificationEntity noti = list.get(position);
		holder.des.setText(noti.getContent());
		return convertView;
	}

}
